﻿namespace ViaConvert.Csv
{
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;

    public class Load
    {
        public static List<Model.Csv.AddressInfo> Init(string FullPath)
        {
            List<Model.Csv.AddressInfo> models = Read(FullPath);
            
            return models;

        }

        private static List<Model.Csv.AddressInfo> Read(string FullPath)
        {
            IList<Model.Csv.AddressInfo> data = null;
            using (var stream = new FileStream(FullPath, FileMode.Open, FileAccess.Read))
            {

                var cs = new Serializer<Model.Csv.AddressInfo>()
                {
                    UseTextQualifier = true,
                    UseLineNumbers = false

                };

                data = cs.Deserialize(stream);
            }

            return data.ToList();

        }
    }
}
